# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer:
pkgname=lua-middleclass
pkgver=4.1.1
pkgrel=1
_luaversions="5.1 5.2 5.3 5.4"
pkgdesc="Object-orientation for Lua"
url="https://github.com/kikito/middleclass"
arch="noarch"
license="MIT"
makedepends="$depends_dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/kikito/middleclass/archive/v$pkgver.tar.gz"
builddir="$srcdir/middleclass-$pkgver"

for _v in $_luaversions; do
	subpackages="$subpackages lua$_v-${pkgname#*lua-}:split_${_v/./_}"
	eval "split_${_v/./_}() { _split $_v; }"
done

package() {
	mkdir -p "$pkgdir"
}

_split() {
	cd "$builddir"
	local _ver="$1"
	install_if="lua$_ver $pkgname=$pkgver-r$pkgrel"
	pkgdesc="Object-orientation for Lua $_ver"
	install -Dm644 middleclass.lua \
		"$subpkgdir/usr/share/lua/$_ver/middleclass.lua"
}

sha512sums="d408435752adf4309a444e1d573ece1d8c79f20dde91f01d7724399079f19a4bfb99083d8cdc70eeb3c1aa21971c272df88cd4c2cce0eb942857de42e4a887e3  lua-middleclass-4.1.1.tar.gz"
